<div class="deliman-wrapper">
<div class="section" id="sitemaplist">

	<div class="section-title">Quản lý nhân viên</div>
    
    <div class="section-content padding1">
    	
    	<form name="frm" id="frm" action="<?php echo $action?>" method="post" enctype="multipart/form-data">
        
        	<div class="button right">
            	<a class="button save" onclick="save()">Lưu</a>
                <a class="button cancel" href="?route=deliman/home">Bỏ qua</a>
     	        <input type="hidden" name="nhanvienid" value="<?php echo $item['nhanvienid']?>">   
     	        <input type="hidden" name="loainhanvienid" value="<?php echo $item['loainhanvienid']?>">
                <input type="hidden" name="masonhanvien" value="<?php echo $item['masonhanvien']?>">
            </div>
            <div class="clearer">^&nbsp;</div>
        	<div id="error" class="error" style="display:none"></div>
            
        	<div>
                <div class="left col2">
                    <p>
                        <label>Tên nhân viên:</label><br />
                        <input type="text" name="hoten" value="<?php echo $item['hoten']?>" class="text" size=60 />
                    </p>    
                    
                    <p>
                        <label>Giới tính:</label><br />
                        <input type="radio" name="gioitinh" value="0" <?php echo ($item['gioitinh']==0)?"checked":""?>/>Nam
                        <input type="radio" name="gioitinh" value="1" <?php echo ($item['gioitinh']==1)?"checked":""?> />Nữ
    
                    </p>    
                    
                    <p>
                        <label>Địa chỉ:</label><br />
                        <input type="text" name="diachi" value="<?php echo $item['diachi']?>" class="text" size=60 />
                    </p>
                    
                    <p>
                        <label>Email:</label><br />
                        <input type="text" name="email" value="<?php echo $item['email']?>" class="text" size=60 />
                    </p>    
                    
                    <p>
                        <label>Điện thoại:</label><br />
                        <input type="text" name="dienthoai" value="<?php echo $item['dienthoai']?>" class="text" size=60 />
                    </p>
                                    
                    
                    <p>
                        <label>Tài khoản:</label>
                        <input type="hidden" name="cotaikhoan" value="<?php echo $item['cotaikhoan']?>" />
                        <?php echo $item['userid']?><br />
                        <a class="button password" href="?route=common/changepassword">Thay đổi Password</a>
                    </p>
                    
                </div>
                <div class="right col2">
                    <p>
                        <label>Tên loại nhân viên:</label><br />
                        <?php echo $this->document->getLoaiNhanVien($item['loainhanvienid'])?>
                    </p>
                    <?php if($item['loainhanvienid'] != 1){?>
                    <div id="phutrachkhuvuc">
                        <p>
                            <label>Khu vực quản lý</label>
                            <table>
                                <tbody id="listkhuvuc">
                                	<?php foreach($data_khuvucphutrach as $val){ ?>
                                    <tr>
                                    	<td>
                                        	<?php echo $val['tenkhuvuc']?>
                                            <?php echo $val['tenphuongxa']?>
                                            <?php echo $val['tenquanhuyen']?>
                                            <?php echo $val['tentinhthanh']?>
                                        </td>
                                    </tr>
                                    <?php } ?>
                                </tbody>
                            </table>
                            <input type="hidden" id="khuvucdel" name="khuvucdel"/>
                        </p>         
                        
                    </div>
                    <?php } ?>
                </div>
                <div class="clearer">^&nbsp;</div>
            </div>
            
        </form>
        
    
    </div>
    
</div>
</div>

<script language="javascript">

$(document).ready(function(){
	
	
});



<!--thực hiện chức năng save dữ liệu-->
function save()
{
	$.blockUI({ message: "<h1>Please wait...</h1>" }); 
	
	$.post("?route=deliman/myaccount/save", $("#frm").serialize(),
		function(data){
			if(data == "true")
			{
				alert('Cập nhật thong tin cá nhân thành công');
				window.location = "?route=deliman/home";
			}
			else
			{
			
				$('#error').html(data).show('slow');
				$.unblockUI();
				
			}
			
		}
	);
}
</script>
